Skip to content

Client builder API replacing Pool sub types#1357

Merged
vietj merged 1 commit into
4.xfrom
client-builer-4.x
Sep 24, 2023
Merged

Client builder API replacing Pool sub types#1357
vietj merged 1 commit into
4.xfrom
client-builer-4.x

Conversation

@vietj

@vietj vietj commented Sep 23, 2023

Copy link
Copy Markdown
Member

A client builder API that replaces Pool sub types like PgPool

Pool pool;

// Build pool with default settings
pool = PgBuilder.pool().using(vertx).build();

// With specific pool settings
pool = PgBuilder
   .pool()
   .connectingTo(new PgConnectOptions().setHost(host).setUsername(username).setPassword(password))
   .using(vertx)
   .build();

// With specific pool settings
pool = PgBuilder
   .pool()
   .with(new PoolOptions().setMaxSize(5))
   .using(vertx)
   .build();

// We should also be able to build pipelined clients when the database supports it
SqlClient client = PgBuilder
   .client()
   .connectingTo(new PgConnectOptions().setHost(host).setUsername(username).setPassword(password))
   .using(vertx)
   .build();
  • introduce a new client builder API that replaces the pool static methods
  • deprecates various Pool subtypes (e.g PgPool) as they are not necessary other than carrying static methods
  • deprecate Pool#connectionHandler and Pool#connectionProvider

@vietj vietj added this to the 4.5.0 milestone Sep 23, 2023
@vietj vietj self-assigned this Sep 23, 2023
@vietj
vietj merged commit f9e17ed into 4.x Sep 24, 2023
@vietj
vietj deleted the client-builer-4.x branch September 24, 2023 11:25
@ghubstan

Copy link
Copy Markdown

@vietj , I have been long at work on a project depending on vertx-pg-client, and upgrading Quarkus (today) also upgraded my pg-client lib to 4.5.4, and I see PgPool is deprecated.

I assume you would like to see others switch to the new client builder API from PgPool ASAP (help find bugs). Are you already encouraging ppl to migrate?

Can you roughly estimate how long I (we) have before PgPool is removed from the project, or is no longer usable, whichever comes first? I am willing to migrate soon -- and report issues I might find -- but would like your feedback first, in case you think the new API is still too "alpha".

Great work, by the way...

@vietj

vietj commented Mar 24, 2024

Copy link
Copy Markdown
Member Author

@ghubstan this deprecation will hold for Vert.x 4 and is removed effectively in Vert.x 5. People should migrate but don't have to unless they want to use Vert.x 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants